﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:PresentationOptions="http://schemas.microsoft.com/winfx/2006/xaml/presentation/options"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:props="clr-namespace:ScrumFactory.Windows.Properties"                    
                    xmlns:sys="clr-namespace:System;assembly=mscorlib">

    <!-- TOOL BAR-->
    <Style TargetType="{x:Type ToolBar}">
        <Setter Property="Background" Value="{StaticResource ToolBarBrush}"/>
        <Setter Property="Foreground" Value="{StaticResource LabelBrush}"/>
        <Setter Property="BorderThickness" Value="0,0,0,0"/>
        <Setter Property="ToolBarTray.IsLocked" Value="True"/>
        <Setter Property="Padding" Value="0"/>
        <Setter Property="Height" Value="75"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ToolBar}">
                    <Border x:Name="Border" 
                            Background="{TemplateBinding Background}"
                            Margin="15,0,0,0" Padding="{TemplateBinding Padding}"  BorderThickness="{TemplateBinding BorderThickness}"  HorizontalAlignment="{TemplateBinding HorizontalAlignment}">
                        <DockPanel>
                            <ToggleButton                                
                                x:Name="moreButton"
                                Visibility="Collapsed"
                                DockPanel.Dock="Right"
                                IsEnabled="{TemplateBinding HasOverflowItems}"
                                
                                IsChecked="{Binding Path=IsOverflowOpen,Mode=TwoWay,RelativeSource={RelativeSource TemplatedParent}}"
                                ClickMode="Press">
                                <Popup x:Name="OverflowPopup"
                                    AllowsTransparency="true"
                                    Placement="Bottom"
                                    IsOpen="{Binding Path=IsOverflowOpen,RelativeSource={RelativeSource TemplatedParent}}"
                                    StaysOpen="false"
                                    Focusable="false"
                                    PopupAnimation="Slide">
                                    <Border x:Name="DropDownBorder"
                                      Background="{TemplateBinding Background}"
                                      BorderThickness="1"
                                      BorderBrush="{TemplateBinding BorderBrush}">
                                        <ToolBarOverflowPanel x:Name="PART_ToolBarOverflowPanel"
                                            Margin="2"
                                            WrapWidth="200"
                                            Focusable="true" 
                                            FocusVisualStyle="{x:Null}"
                                            KeyboardNavigation.TabNavigation="Cycle"
                                            KeyboardNavigation.DirectionalNavigation="Cycle"/>
                                    </Border>
                                </Popup>
                            </ToggleButton>
                            <ToolBarPanel                                
                                x:Name="PART_ToolBarPanel" 
                                HorizontalAlignment="Stretch"
                                IsItemsHost="true"/>
                        </DockPanel>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="HasOverflowItems" Value="true">
                            <Setter TargetName="moreButton" Property="Visibility" Value="Visible"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                    <ControlTemplate.Resources>

                        <!--<Style TargetType="{x:Type Border}" BasedOn="{StaticResource ToolBarInsideBorder}" />-->
                            

                        <Style TargetType="{x:Type MenuItem}" BasedOn="{StaticResource Toolbar_MenuItemStyle}"/>
                        <!--<Style TargetType="MenuItem" />-->

                        <Style x:Key="{x:Static ToolBar.MenuStyleKey}" TargetType="Menu" BasedOn="{StaticResource {x:Type Menu}}">
                            <Setter Property="Margin" Value="0,0,0,0"/>
                            <Setter Property="Padding" Value="0,0,0,0"/>
                            <Setter Property="ItemContainerStyle" Value="{StaticResource Toolbar_MenuItemStyle}"/>
                        </Style>

                       

                    </ControlTemplate.Resources>
                </ControlTemplate>
            </Setter.Value>
        </Setter>

    </Style>






</ResourceDictionary>